/*     */ package com.lmpop.trade.ti_ask;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import com.lmpop.frame.util.FileIO;
/*     */ import com.lmpop.updateHtml.parseXml.Config;
/*     */ import com.lmpop.updateHtml.updateHtml.UpdateArticleHtml;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ 
/*     */ public class Ti_askInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */   FileIO io;
/*     */   Config conf;
/*     */   String rootpath;
/*     */   UpdateArticleHtml uah;
/*     */ 
/*     */   public Ti_askInfo()
/*     */   {
/*  23 */     this.queryList = new QueryList();
/*  24 */     this.uah = new UpdateArticleHtml();
/*  25 */     this.io = new FileIO();
/*  26 */     this.conf = new Config();
/*  27 */     this.conf.init();
/*  28 */     this.rootpath = this.conf.getString("rootpath");
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  36 */     Ti_ask ti_ask = new Ti_ask();
/*  37 */     ti_ask.setTrade_id(map.getString("trade_id"));
/*  38 */     ti_ask.setCust_id(map.getString("cust_id"));
/*  39 */     ti_ask.setTitle(map.getString("title"));
/*  40 */     ti_ask.setContents(map.getString("contents"));
/*  41 */     ti_ask.setState_code(map.getString("state_code"));
/*  42 */     ti_ask.setReply(map.getString("reply"));
/*  43 */     ti_ask.setClass_attr(map.getString("class_attr"));
/*  44 */     ti_ask.setReply_num(map.getInt("reply_num"));
/*  45 */     ti_ask.setUser_id(map.getString("user_id"));
/*  46 */     ti_ask.setUser_name(map.getString("user_name"));
/*  47 */     ti_ask.setIn_date(map.getString("in_date"));
/*     */ 
/*  49 */     String result_code = "0";
/*     */     try {
/*  51 */       insert(dbmMgr, ti_ask);
/*     */     } catch (ApplicationException e) {
/*  53 */       e.printStackTrace();
/*  54 */       result_code = "1";
/*     */     }
/*  56 */     map.setString("result_code", result_code);
/*  57 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_ask ti_ask)
/*     */     throws ApplicationException
/*     */   {
/*  66 */     dbmMgr.update("insertTi_ask", ti_ask);
/*     */   }
/*     */ 
/*     */   public SysMap create_alterPage(DbmInterf dbmMgr, SysMap map) {
/*  70 */     this.uah.updateArticleByGoodsId("37E27O6M4m4674x", map.getString("trade_id"), "0", "1");
/*  71 */     return map;
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  79 */     String pkid_string = map.getString("pkid");
/*  80 */     String result_code = "0";
/*     */     try {
/*  82 */       if (!pkid_string.equals("")) {
/*  83 */         String[] pkStr = pkid_string.split("\\|");
/*  84 */         List list = null;
/*  85 */         String publish_date = "";
/*  86 */         for (int i = 0; i < pkStr.length; i++)
/*  87 */           if (!pkStr[i].equals("")) {
/*  88 */             list = this.queryList.getList("getTi_askByPk", pkStr[i]);
/*  89 */             publish_date = ((Hashtable)list.get(0)).get("in_date").toString();
/*  90 */             publish_date = publish_date.substring(0, 10);
/*  91 */             delete(dbmMgr, pkStr[i]);
/*  92 */             FileIO.DelFile(this.rootpath + "/data/jinseyaoshi/ask/" + publish_date + "/" + pkStr[i] + ".html");
/*     */           }
/*     */       }
/*     */     }
/*     */     catch (ApplicationException e) {
/*  97 */       e.printStackTrace();
/*  98 */       result_code = "1";
/*     */     }
/* 100 */     map.setString("result_code", result_code);
/* 101 */     return map;
/*     */   }
/*     */ 
/*     */   public SysMap updateStateCode(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 111 */     Ti_ask ti_ask = new Ti_ask();
/* 112 */     String pkid_string = map.getString("pkid");
/*     */ 
/* 114 */     String result_code = "0";
/*     */     try {
/* 116 */       if (!pkid_string.equals("")) {
/* 117 */         String[] pkStr = pkid_string.split("\\|");
/* 118 */         for (int i = 0; i < pkStr.length; i++) {
/* 119 */           if (!pkStr[i].equals(""))
/* 120 */             ti_ask.setState_code(map.getString("state_code"));
/* 121 */           ti_ask.setTrade_id(pkStr[i]);
/* 122 */           updateStateCode(dbmMgr, ti_ask);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/* 126 */       e.printStackTrace();
/* 127 */       result_code = "1";
/*     */     }
/* 129 */     map.setString("result_code", result_code);
/* 130 */     return map;
/*     */   }
/*     */   public void updateStateCode(DbmInterf dbmMgr, Ti_ask ti_ask) throws ApplicationException {
/* 133 */     dbmMgr.update("updateState_Code", ti_ask);
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/* 142 */     dbmMgr.update("deleteTi_ask", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 151 */     Ti_ask ti_ask = new Ti_ask();
/* 152 */     ti_ask.setTrade_id(map.getString("trade_id"));
/* 153 */     ti_ask.setCust_id(map.getString("cust_id"));
/* 154 */     ti_ask.setTitle(map.getString("title"));
/* 155 */     ti_ask.setContents(map.getString("contents"));
/* 156 */     ti_ask.setState_code(map.getString("state_code"));
/* 157 */     ti_ask.setReply(map.getString("reply"));
/* 158 */     ti_ask.setClass_attr(map.getString("class_attr"));
/* 159 */     ti_ask.setReply_num(map.getInt("reply_num"));
/* 160 */     ti_ask.setUser_id(map.getString("user_id"));
/* 161 */     ti_ask.setUser_name(map.getString("user_name"));
/* 162 */     ti_ask.setIn_date(map.getString("in_date"));
/*     */ 
/* 164 */     String result_code = "0";
/*     */     try {
/* 166 */       update(dbmMgr, ti_ask);
/* 167 */       this.uah.updateArticleByGoodsId("37E27O6M4m4674x", map.getString("trade_id"), "0", "1");
/*     */     } catch (ApplicationException e) {
/* 169 */       e.printStackTrace();
/* 170 */       result_code = "1";
/*     */     }
/* 172 */     map.setString("result_code", result_code);
/* 173 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_ask ti_ask)
/*     */     throws ApplicationException
/*     */   {
/* 182 */     dbmMgr.update("updateTi_ask", ti_ask);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 192 */     Hashtable ti_ask = (Hashtable)obj;
/* 193 */     if (start == 0)
/* 194 */       start = 0;
/*     */     else {
/* 196 */       start = (start - 1) * limit;
/*     */     }
/* 198 */     ti_ask.put("start", Integer.valueOf(start));
/* 199 */     ti_ask.put("limit", Integer.valueOf(limit));
/* 200 */     return this.queryList.getList("getListByTi_askPage", ti_ask);
/*     */   }
/*     */   public List getListByCust(Object obj, int start, int limit) {
/* 203 */     Hashtable ti_ask = (Hashtable)obj;
/* 204 */     if (start == 0)
/* 205 */       start = 0;
/*     */     else {
/* 207 */       start = (start - 1) * limit;
/*     */     }
/* 209 */     ti_ask.put("start", Integer.valueOf(start));
/* 210 */     ti_ask.put("limit", Integer.valueOf(limit));
/* 211 */     return this.queryList.getList("getListByCust", ti_ask);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 221 */     Hashtable ti_ask = (Hashtable)obj;
/* 222 */     List list = this.queryList.getList("getCountByObjTi_ask", ti_ask);
/* 223 */     int count = 0;
/* 224 */     if ((list != null) && (list.size() > 0)) {
/* 225 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 226 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 227 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 230 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 240 */     return this.queryList.getList("getTi_askByPk", pk);
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_ask.Ti_askInfo
 * JD-Core Version:    0.6.0
 */